package xyz.yq56.easytool.utils.date;

import java.text.SimpleDateFormat;

import org.springframework.util.StringUtils;

/**
 * @author yi qiang
 * @date 2021/9/17 0:56
 */
public class DateFormatter {

    private DateFormatter() {}

    public static SimpleDateFormat standardFormatter() {
        return formatter("yyyy-MM-dd HH:mm:ss");
    }

    public static SimpleDateFormat formatter() {
        return formatter(null);
    }

    public static SimpleDateFormat formatter(String pattern) {
        return StringUtils.isEmpty(pattern)
                ? new SimpleDateFormat()
                : new SimpleDateFormat(pattern);
    }
}
